<?

require_once ("application.fieldset.inc");

global $_GLOBAL_DBH;
global $_OBJECT_IFACE_PANEL;

$fieldset_timer = new Fieldset (array (
	db_conn=>$_GLOBAL_DBH,
	relation=>"project_task_timer",
	prefix=>"ptt_",
	fieldset=>array (
		array (name=>"id",label=>"ID",type=>"numeric",
				value=>$_REQUEST["timer_id"],
				input=>"hidden",primary_key=>true),
		array (name=>"task_id",label=>"Task Title",type=>"numeric",
				relation=>array(foreign=>"project_tasks",key=>"id",
						field=>"title"),
				input=>"select",
				disabled=>true,
				excluded=>true,
				options=>"_app_select_query",
				options_params=>"SELECT id,title FROM project_tasks",
				columns=>array (key=>"id",value=>"title"),
		),
		array (name=>"date_begin",label=>"Date Begin",type=>"any",
				input=>"date_time",
				value=>_app_date_time ("ptt_date_begin")),
		array (name=>"date_end",label=>"Date End",type=>"any",
				input=>"date_time",
				value=>_app_date_time ("ptt_date_end")),
	)
));

$fieldset_timer->parse ();

$return = "/fs_projects.php?fs_tab_users=main&project_id={$_REQUEST["project_id"]}&fs_tab=users&fs_tab_option=fs_users&fs_action=view&user_id={$_REQUEST["user_id"]}";

$fs_options = array (
	addnew=>array (label=>"Add New"),
	create=>array (label=>"Create"),
	modify=>array (label=>"Modify"),
	remove=>array (label=>"Remove"),
	update=>array (label=>"Update"),
	cancel=>array (label=>"Cancel"),
	delete=>array (label=>"Delete",
			redirect=>dirname ($_SERVER["PHP_SELF"]) . $return),
	canret=>array (label=>"Cancel",
			redirect=>dirname ($_SERVER["PHP_SELF"]) . $return),
	close=>array (label=>"Close",
			redirect=>dirname ($_SERVER["PHP_SELF"]) . $return),
);

$image_options = array (size=>$_REQUEST["_img_size"]);

list ($fs_input, $fs_action, $store, $valid, $success) =

	_app_process_fieldset (array (
		fieldset=>$fieldset_timer,
		fs_options=>$fs_options,
		fs_primary_key=>"timer_id",
		fs_action=>($_REQUEST["fs_action_timer"] ?
				$_REQUEST["fs_action_timer"] :
				"view"),
		fs_action_field=>"fs_action_timer",
		fs_prefix=>"ptt_",
));

$_OBJECT_FIELDSET_CONTROL =_app_create_fieldset_object (array (
	fieldset_id=>"fs_project_user_timer",
	db_conn=>$_GLOBAL_DBH,
	fieldset=>$fieldset_timer,
	fs_action=>$fs_action,
	fs_input=>$fs_input,
	fs_link=>"fs_projects.php?fs_tab=users&project_id={$_REQUEST["project_id"]}&fs_tab_option=fs_users&fs_action=view&fs_tab_users=main&fs_tab_option_users=fs_timer&user_id={$_REQUEST["user_id"]}",
	fs_options=>$fs_options,
	fs_action_field=>"fs_action_timer",
	fs_prefix=>"ptt_",
));

$_OBJECT_IFACE_TABBING_PANEL->insert_container ($_OBJECT_FIELDSET_CONTROL);

?>
